﻿


Public Class CameraSelectPanel

    'Camera Infos Selected :
    Private Sub CLP_CameraInfosSelected(sender As Object, e As CameraInfosSelectedEventArgs) Handles CLP.CameraInfosSelected
        LCIP.Enabled = True
        WCIP.Enabled = True
        If TypeOf e.SelectedCameraInfos Is LocalCameraInfos Then
            LCIP.Infos = CType(e.SelectedCameraInfos, LocalCameraInfos)
            LCIP.Visible = True
            WCIP.Visible = False
        ElseIf TypeOf e.SelectedCameraInfos Is JpegCameraInfos Then
            WCIP.Infos = CType(e.SelectedCameraInfos, JpegCameraInfos)
            LCIP.Visible = False
            WCIP.Visible = True
        ElseIf TypeOf e.SelectedCameraInfos Is MjpegCameraInfos Then
            WCIP.Infos = CType(e.SelectedCameraInfos, MjpegCameraInfos)
            LCIP.Visible = False
            WCIP.Visible = True
        End If
        _CurrentCI = e.SelectedCameraInfos
    End Sub
    'Load Camera :
    Public Event CameraLoadRequested As EventHandler(Of CameraLoadRequestedEventArgs)
    Private _CurrentCI As ICameraInfos = Nothing
    Private Sub KB_LoadCamera_Click(sender As System.Object, e As System.EventArgs) Handles KB_LoadCamera.Click
        RaiseEvent CameraLoadRequested(Me, New CameraLoadRequestedEventArgs(_CurrentCI))
    End Sub
    'Empty List Event :
    Private Sub CLP_CameraListEmpty(sender As Object, e As System.EventArgs) Handles CLP.CameraListEmpty
        LCIP.Infos = Nothing
        LCIP.Enabled = False
        WCIP.Infos = Nothing
        WCIP.Enabled = False
    End Sub

End Class

Public Class CameraLoadRequestedEventArgs
    Inherits EventArgs
    Public Sub New(ici As ICameraInfos)
        _CameraInfos = ici
    End Sub
    Private _CameraInfos As ICameraInfos
    Public ReadOnly Property CameraInfos As ICameraInfos
        Get
            Return _CameraInfos
        End Get
    End Property
End Class